package Chapter2.Comparing.c7;

import java.io.FileInputStream;
import java.io.IOException;

public class IOExceptionTest {
    /*public static void main(String[] args) throws IOException {
        FileInputStream in=new FileInputStream("myfile.txt");
        int b;
        b = in.read();
        while(b!= -1) {
            System.out.print((char)b);
            b = in.read();
        }
        in.close();
    }*/

    public static void main(String[] args){
        try{
            FileInputStream in=new FileInputStream("myfile.txt");
            int b;
            b = in.read();
            while(b!= -1)       {
                System.out.print((char)b);
                b = in.read();
            }
            in.close();
        }catch (IOException e) {
            System.out.println(e);
        }finally {
            System.out.println(" It’s ok!");
        }
    }

}
